﻿@using AntDesign.ProLayout
@using ERP.Abp.AspnetCore.Components.Web.AntDesignTheme.Routing
@using ERP.Abp.AspnetCore.Components.Web.AntDesignTheme.Themes.AntDesignTheme
@using Microsoft.Extensions.Options
@using System.Threading
@using System.Globalization
@using System.Collections.Immutable
@using Volo.Abp.Localization
@using ERP.Abp.AntDesignUI
 
@inherits  ERPComponentBase
@inject IOptions<AbpRouterOptions> RouterOptions
@*@inject ILanguageProvider LanguageProvider
@inject IConfiguration IConfiguration;*@
@inject IJSRuntime IJSRuntime;

@if (!CurrentUser.IsAuthenticated)
{
   <RedirecToLogin></RedirecToLogin>    
}
 
<CascadingAuthenticationState>
    <Router AppAssembly="RouterOptions.Value.AppAssembly"   AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
        <Found Context="routeData">
             <AuthorizeReuseTabsRouteView     RouteData="routeData"  DefaultLayout="typeof(BasicLayout)">
             </AuthorizeReuseTabsRouteView>
        </Found>
        <NotFound>
            <LayoutView >
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>
@*<AntContainer />
*@

@*<Router AppAssembly="RouterOptions.Value.AppAssembly"   AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
    <Found Context="routeData">>
        <RouteView  RouteData="routeData"  DefaultLayout="@typeof(BasicLayout)"></RouteView>
    </Found>
    <NotFound>
            <LayoutView >
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
    </NotFound>
</Router>*@

@code{
    private IReadOnlyList<LanguageInfo> _otherLanguages;
    private LanguageInfo _currentLanguage;
    protected  async   override Task OnInitializedAsync()
    {
       // AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateChanged;
       // NavigationManager.LocationChanged += LocationChanged;
        base.OnInitialized();
        await   OnThemeChange();
    }
    private void LocationChanged(object sender, LocationChangedEventArgs args)
    {
        
    }
    private void AuthenticationStateChanged(Task<AuthenticationState> authenticationState)
    {
    }
    private async Task OnThemeChange()
    {
        base.StateHasChanged();
        var bg = await IJSRuntime.InvokeAsync<string>("dom.getStyle", ".ant-layout", "background");
        await IJSRuntime.InvokeVoidAsync("dom.css", "#ApplicationContainer .naviatiotabs .ant-tabs-nav", new { background = bg });
    }
}


 